<div id="nav" style="display:none;">
  <dl>
    <dt>当前位置：</dt>
    <dd class="link">网址管理</dd>
    <!--导航-->
    <dd class="link">网址列表</dd>
    <!--导航-->
  </dl>
</div>
<script type="text/javascript">
	if ($.browser.msie) {
		document.execCommand("BackgroundImageCache", false, true);
	}
	var nav = document.getElementById("nav");
	var pnav = window.parent.document.getElementById("nav")
	pnav.innerHTML = nav.innerHTML;

</script>
<div class="wrap">
  <div class="container">
    <div id="main">
      <div class="con">
        <form action="?c=site_manage&a=search" method="get">
          <input type="hidden" name="c" value="site_manage"/>
          <input type="hidden" name="a" value="search"/>
          <div class="table">
            <div class="th"> 站点搜索:
              <input type="text" value="" id="keyword" name="keyword"/>
              <select name="search_type">
                <option value="name">名称</option>
                <option value="url"  >网址</option>
              </select>
              <input type="submit" value="搜索" />
            </div>
          </div>
        </form>
        <form action="?c=site_manage&a=list_edit" method="post">
          <input type="hidden" name="referer" value="/admin/index.php?c=site_manage"/>
          <div class="table">
            <div class="th">
              <div class="form fl">
                <input type="button" value="添加网址" onClick="self.location='<?=Yii::app()->createURL('urlsite/create')?>'"/>
                &nbsp;
                <label for="alltopic"><a href='?c=class'>选择分类</a></label>
                &nbsp;
                &nbsp;&nbsp;<a href='?c=site_manage'>查看所有分类</a>
                </label>
                &nbsp;
                &nbsp;&nbsp;<a href="?c=site_manage&isend=1">查看过期站点</a>&nbsp; </div>
            </div>
            <table class="admin-tb" id="js_data_source">
              <tr>
                <th width="41" class="text-center">删除</th>
                <th width="40">推荐</th>
                <th width="70">排序</th>
                <th width="120">网站</th>
                <th width="180">网址</th>
                <th width="80">分类</th>
                <th width="80">开始时间</th>
                <th width="80">结束时间</th>
                <th>添加人</th>
              </tr>              
              <?php $this->widget('zii.widgets.ClistView',array(
			  		'dataProvider' => $dataProvider,
					'itemView' => '_siteview',
					'template' => '{items}',
			  ))?>             
              <tr class="foot-ctrl">
                <td colspan="9" class="gray">选择: <a href="#" onClick="checkTb1(1);">全选</a> - <a href="#" onClick="checkTb1(3);">反选</a> - <a href="#" onClick="checkTb1(2);">无</a></td>
              </tr>
            </table>
            <script type="text/javascript">
                    	$(document).ready(function(){
                    		$("#js_data_source").find("input[rel='del']").each(function(i){
								$(this).bind("click",function(){
									var tr = $(this).parent().parent();
									var input = tr.find("input[rel='dis']");
									if(this.checked){
										$(input).attr("checked","");
										$(input).attr("disabled","disabled");
									}
									else{
										$(input).attr("disabled","");
									}
								});								
							});
                            /*
							$("#js_data_source").find("input[rel='del']").each(function(i){
								
								$(this).bind("click",function(){
									var tr = $(this).parent().parent();
									var input = tr.find("input[rel='dis']");
									if(this.checked){
										$(input).attr("oledchecked",$(input).attr("checked"));
										$(input).attr("checked","");
										$(input).attr("disabled","disabled");
									}
									else{
										$(input).attr("disabled","");
										$(input).attr("checked",$(input).attr("oledchecked"));
									}
									
									$(".admin-tb").find("input[rel='del']").each(function(i){
										var tr2 = $(this).parent().parent();
										if(this.checked){
											tr2.addClass("checked");
										}
										else{
											tr2.removeClass("checked");
										}
									})
								});								
							});
                            */
							$("#js_data_source").find("input[rel='dis']").change(function(){
                                if ($(this).next('input[type="hidden"]').val() == 1) $(this).next('input[type="hidden"]').val(0);
                                else $(this).next('input[type="hidden"]').val(1);
							});
						});
                    </script>
            <div class="th">              
				<?php $this->widget('zii.widgets.ClistView',array(
			  		'dataProvider' => $dataProvider,
					'pager' => array(
								'class'=>'CLinkPager', 
                                'firstPageLabel'=>'首页', 
                                'lastPageLabel'=>'末页', 
                                'nextPageLabel'=>'下一页', 
                                'prevPageLabel'=>'上一页', 
                                'header'=>'', 
                                'cssFile'=>false,																				
					),
					'itemView' => '_siteview',
					'ajaxUpdate' => false,
					'template' => '{pager}',
			  ))?>
               
              <div class="form">
                <input value="提交修改" type="submit"/>
                &nbsp; </div>
            </div>
          </div>
        </form>
      </div>
      <!--/ con--> 
    </div>
  </div>
  <!--/ container--> 
</div>
<!--/ wrap--> 
<script type="text/javascript">
	var list;
	$(document).ready(function(){
		list = $("#js_data_source").find("input[type='checkbox']").filter("[rel='del']");
		list.each(function(i){
			$(this).bind("click",function(){
				CheckHanler();
			});
		});
	});
	
	var CheckHanler = function(){
		list.each(function(i){
			var input = $(this);
			if(this.checked){
				input.parent().parent().addClass("checked");
			}
			else{
				input.parent().parent().removeClass("checked");
			}
		});
	}
	
	var checkTb1 = function(selectType){
		CheckInit("js_data_source",selectType);
	}
	
	var CheckInit = function(tabelId,selectType){
		if(list == undefined){
			list = $("#" + tabelId).find("input[type='checkbox']").filter("[rel='del']");
		}
		CheckControl(list,selectType,CheckHanler)
	}
	
	var CheckControl = function(childs,selectType,checkHandler){
		for(var i = 0,len = childs.length; i < len; i++){
			switch(selectType){
				case 1:	//全选
					childs[i].checked = true;
					break;
				case 2:	//不选
					childs[i].checked = false;
					break;
				case 3:	//反选
					childs[i].checked = !childs[i].checked;
					break;
			}
		}
		if(checkHandler){
			checkHandler();
		}
	}
</script>
<p style="text-align:center;padding:15px;color:#6B7355;font-family:Verdana;font-size:12px;"> Powered by <a href="http://www.ylmf.com" target="_blank"> <b>雨林木风</b></a> &copy; 2009 <a href="http://www.114la.com" target="_blank"> <b>114la.com</b></A><a href="http://www.ylmf.com" target="_blank"></a> </p>
